﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="Easy.Web.changepassword" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="/_css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="/_js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <title>修改密码</title>
    <style type="text/css">
        #div1 {
            border:1px solid #6fceff;
            width:350px;
            margin-left:auto;
            margin-right:auto;
            margin-top:20px;
            border-radius:5px;
            background-color:#ffffff;
        }
        body {
            width:100%;
            height:100%;
            background-image:  url("_imgs/1.png");
            background-repeat:no-repeat;
            background-size:100%;
        }

    </style>

</head>
<body>
<div id="div1">
               <form method="post"  id="form1" style="margin: 30px auto; width: 300px;">


                <div class="form-group">
                    <label for="username">原始密码</label><input name="username" type="password" id="oldpassword" class="form-control"  />
                </div>
                <div class="form-group">
                    <label for="password">
                        新的密码</label>
                    <input name="password" type="password" id="newpassword" class="form-control" />
                </div>
                    <div class="form-group">
                    <label for="password">
                        再次输入</label>
                    <input name="password" type="password" id="repassword" class="form-control" />
                </div>
                <div style="color: #ff0000">
                    
                </div>
                <input type="button" name="btn_login" value="确认修改" id="btnok" class="btn btn-info btn-block" />
             
                   
              </form>
  
 
</div>

        <script type="text/javascript">
            window.onload = function () {
               
                $("#btnok").on("click", function () {
                    var oldpassword = $("#oldpassword").val();
                    var newpassword = $("#newpassword").val();
                    var repassword = $("#repassword").val();
                    if (oldpassword == "")
                    {
                        alert("请输入原始密码！");
                    } else if (newpassword=="") {
                        alert("请输入新密码！");
                    } else if (repassword == "") {
                        alert("请再次输入新密码！");
                    }
                    else {
                          if (oldpassword != newpassword) {
                              if (newpassword == repassword) {
                                  
                                  $.post("/service/data/updatepass.ashx", { "oldpass": oldpassword, "newpass": newpassword }, function (temp) {                                    
                                      alert(temp);
                                      var str = "密码修改成功";
                                      if (temp.trim() == str) {
                                          window.close();
                                      }
                                 });
                              } else {
                                  alert("两次输入的新密码不一致！");
                                }
                           } else {
                              alert("原始密码与新密码一致！请重新输入新密码！");
                           }
                    }
                });
            }
    </script>
</body>
</html>
